package behavioralPattern.memento.example01;

import lombok.Data;

/**
 * 发起人角色
 */
@Data
public class Originator {
    private String state = "1";
    private String id;
    private String name;
    private String phone;

    public Originator() {
    }

    // 创建备忘录对象
    public Memento createMemento(){
        return new Memento(id,name,phone);
    }

    // 恢复对象状态
    public void restoreMemento(Memento memento){
        this.state = memento.getState();
        this.id = memento.getId();
        this.name = memento.getName();
        this.phone = memento.getPhone();
    }
}
